from typing import List, Optional
from datetime import datetime
from pydantic import BaseModel, Field

class ConversationBase(BaseModel):
    timestamp: Optional[datetime] = Field(default_factory=datetime.utcnow)
    user_id: Optional[str] = None
    role: str
    content: str
    tags: Optional[List[str]] = []
    context_id: Optional[str] = None
    source: Optional[str] = None

class ConversationCreate(ConversationBase):
    pass

class ConversationInDB(ConversationBase):
    id: int

    class Config:
        orm_mode = True

class ConversationOut(ConversationInDB):
    pass 